---
title: Configuration.decodeHTTPResponse()
api: Configuration.decodeHTTPResponse
---

## Description

<Summary/>

<FilterDiagram
  name="decodeHTTPResponse"
  input="Data"
  output="Message"
/>

After decoding, the output [Message](/reference/api/Message) has:

* _head_
  - _protocol_ - Can be `"HTTP/1.0"` or `"HTTP/1.1"`
  - _status_ - Response status code
  - _statusText_ - Response reason phrase
  - _headers_ - Header fields
* _body_ - Message body

Header names are all converted to lowercase. So `"Connection"` becomes `"connection"` and `"Content-Type"` becomes `"content-type"`.

This filter only supports HTTP/1.x. For compatibility with HTTP/2, check out [muxHTTP()](/reference/api/Configuration/muxHTTP).

### Response to HEAD requests

When decoding a response to a HEAD request, you need to tell the filter that the response is supposed to have no body following the header so that the decoder won't be waiting for a body perpetually. You do so by the _bodiless_ option in the _options_ parameter. It can be a boolean value or a function that returns a boolean value.

### Handling trasport errors

[StreamEnd](/reference/api/StreamEnd) events on the input, when coming with an error, will be decoded as a 4xx/5xx responses, depending on the error code carried by the event.

| _StreamEnd_ Error |   | Status Code + Reason Phrase |
|:------------------|---|:----------------------------|
| CannotResolve     |   | 502 Cannot Resolve          | 
| ConnectionRefused |   | 502 Connection Refused      |
| Unauthorized      |   | 401 Unauthorized            |
| ReadError         |   | 502 Read Error              |
| WriteError        |   | 502 Write Error             |
| ConnectionTimeout |   | 504 Gateway Timeout         |
| ReadTimeout       |   | 504 Gateway Timeout         |
| WriteTimeout      |   | 504 Gateway Timeout         |
| Other errors...   |   | 502 Bad Gateway             |

## Syntax

``` js
pipy()
  .pipeline()
  .decodeHTTPResponse()

pipy()
  .pipeline()
  .decodeHTTPResponse({
    bodiless,
  })
```

## Parameters

<Parameters/>

## See Also

* [Configuration](/reference/api/Configuration)
* [decodeHTTPRequest()](/reference/api/Configuration/decodeHTTPResponse)
* [encodeHTTPRequest()](/reference/api/Configuration/encodeHTTPRequest)
* [encodeHTTPResponse()](/reference/api/Configuration/encodeHTTPResponse)
* [muxHTTP()](/reference/api/Configuration/muxHTTP)
